package com.diligent.cloud.sfc.resources.impl;

import com.canny.commons.model.ListResult;
import com.canny.commons.model.ObjectResult;
import com.diligent.cloud.sfc.model.params.inventory.AddPowderInventoryParams;
import com.diligent.cloud.sfc.resources.WorkshopSceneSprayingProcessResource;
import com.diligent.cloud.sfc.service.WorkshopSceneSprayingProcessService;
import com.diligent.cloud.web.resource.impl.AbstractActionResourceImpl;
import com.diligent.cloud.workorder.model.WoLots;
import com.diligent.foundation.web.action.DiligentActionFunction;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;

/**
 * WorkshopSceneSprayingProcessResourceImpl class
 *
 * @author xf107278
 * @date 4/17/2020
 */
@RestController
public class WorkshopSceneSprayingProcessResourceImpl extends AbstractActionResourceImpl implements WorkshopSceneSprayingProcessResource {

    private WorkshopSceneSprayingProcessService workshopSceneSprayingProcessService;

    public WorkshopSceneSprayingProcessResourceImpl(WorkshopSceneSprayingProcessService workshopSceneSprayingProcessService) {
        this.workshopSceneSprayingProcessService = workshopSceneSprayingProcessService;
        init();
    }

    private void init() {
        DiligentActionFunction diligentActionFunction = (var1, var2, var3) -> {
            AddPowderInventoryParams var31 = (AddPowderInventoryParams) var3;

            return workshopSceneSprayingProcessService.addPowderInventory(var31.getPowderBoxParams(), var31.getBackPowder(), var31.getPrincipal());
        };
        super.registerAction(HttpMethod.POST.toString(), "addPowderInventory", AddPowderInventoryParams.class, diligentActionFunction);


    }

    @Override
    public ResponseEntity<ObjectResult> selectById(Long id) {
        return null;
    }


    @Override
    public ResponseEntity<ListResult> getLotsFilter(String woOrder, Long systemId) {
        return workshopSceneSprayingProcessService.getLotsFilter(woOrder,systemId);
    }

    @Override
    public ResponseEntity<ObjectResult<WoLots>> getLotsInfo(String lotCode) {
        return workshopSceneSprayingProcessService.getLotsInfo(lotCode);
    }

    @Override
    public ResponseEntity<ObjectResult<WoLots>> lotsUp(String lotCode) {
        return null;
    }
}
